home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tphrt3.zip / DEMOV3.PAS < prev    next >
Pascal/Delphi Source File  |  1990-07-23  |  4KB  |  91 lines

  1. {----------------------------------------------------------------------------
  2.  |  Program DEMOV3.PAS                                                      |
  3.  |                                                                          |
  4.  |  This program demonstrates some of the capabilities of TPHRT.            |
  5.  |                                                                          |
  6.  |  (c) 1989 Ryle Design, P.O. Box 22, Mt. Pleasant, Michigan 48804         |
  7.  |                                                                          |
  8.  |  V3.00 Shareware Evaluation Version                                      |
  9.  ----------------------------------------------------------------------------}
  10.  
  11. uses
  12.     CRT, TPHRT;
  13.  
  14. var
  15.     hits, elapsed : longint;
  16.     indx          : integer;
  17.     tstring       : string;
  18.     atom          : char;
  19.  
  20. procedure sin_funct;
  21. {----------------------------------------------------------------------------
  22.  |  A simple procedure to time.   TPHRT will tell us how many this function |
  23.  |  was called and how much time we spent here.                             |
  24.  |                                                                          |
  25.  |  Globals referenced: none                                                |
  26.  |                                                                          |
  27.  |  Arguments: void                                                         |
  28.  |                                                                          |
  29.  |  Returns  : void                                                         |
  30.  ----------------------------------------------------------------------------}
  31. var
  32.     alpha : real;
  33.  
  34. begin
  35.  
  36.     t_entry(5);                                             { start a timer }
  37.  
  38.     alpha := sin(2.2734593);                                { do something  }
  39.  
  40.     t_exit(5);                                              { stop timer    }
  41.  
  42. end; { sin_funct }
  43.  
  44.  
  45. begin
  46.  
  47.     t_request(5);                                           { ask for 5 timers - default is 10 }
  48.     t_start;                                                { turns on TPHRT }
  49.     t_entry(1);                                             { use  timer 1 to time whole run }
  50.  
  51.     writeln('TPHRT V3.00 demonstration');
  52.     write('Press any key ... ');
  53.  
  54.     t_entry(3);                                             { start timer # 3 }
  55.     atom := readkey;
  56.     t_exit(3);                                              { stop timer # 3 }
  57.     writeln;
  58.  
  59.     t_ask_timer(3,hits,elapsed);                            { query timer # 3 }
  60.  
  61.     writeln('Response time was ',elapsed,' microseconds, or ',t_cvt_time(elapsed,tstring));
  62.  
  63.     write('Calling sin function with embedded timer 100 times ... ');
  64.     for indx := 1 to 100 do sin_funct;
  65.     writeln('complete.');
  66.  
  67.     writeln;
  68.     write('Press any key to generate timer reports >> ');
  69.     atom := readkey;
  70.     writeln;
  71.  
  72.     t_exit(1);                                              { stop run time timer }
  73.  
  74.     t_rname('TPHRT Demonstration - HIGHWATER report type'); { title timer report }
  75.     t_name(1,'Total run time');                             { give each timer a name }
  76.     t_name(3,'Keyboard response');
  77.     t_name(5,'sin function');
  78.  
  79.     t_report(0);                                            { do report - 0 goes to CRT }
  80.  
  81.     t_set_report(NONZERO);
  82.     t_rname('TPHRT Demonstration - NONZERO report type');
  83.     t_report(0);
  84.  
  85.     t_stop;
  86.  
  87.     writeln('TPHRT demo complete.');
  88.  
  89. end. { demov3 }
  90.  
  91.